<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    
        <meta name="format-detection" content="telephone=no" />
    <title>男装专区</title>
    <link rel="stylesheet" type="text/css" href="/taobao/css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="/taobao/css/loading.css"/>
    <link rel="stylesheet" type="text/css" href="/taobao/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="/taobao/css/style.css"/>
      <script src="/taobao/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
    	$(window).load(function(){
    		$(".loading").addClass("loader-chanage")
    		$(".loading").fadeOut(300)
    		
    		
    	})
    </script>
</head>
<!--loading页开始-->
<div class="loading">
	<div class="loader">
        <div class="loader-inner pacman">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
	</div>
</div>
<!--loading页结束-->
<body>
	<header class="top-header fixed-header">
			<a class="icona" href="javascript:history.go(-1)">
					<img src="/taobao/images/left.png"/>
			</a>
			<h3>去结算</h3>
			<a class="iconb" href="shopcar.html">
			</a>
	</header>
	
	<div class="contaniner fixed-cont">
		<section class="to-buy">
			<header>
				<div class="now">
					<span><img src="/taobao/images/map-icon.png"/></span>
						<dl th:each="uj:${addressList}">
							<input th:hidden="true" th:value="${uj.id}" id="addressid"/>
							<dt>
								<b th:text="${uj.name}">瑾晨</b>
								<strong th:text="${uj.mobile}">13035059860</strong>
							</dt>
							<dd th:text="${uj.detail}">安徽省合肥市XXXXXXXX</dd>
							<p>其他地址</p>
						</dl>
				</div>
				
				<!--<div class="to-now">
					<div class="tonow">
							<label for="tonow"  onselectstart="return false" ></label>
							<input type="checkbox" id="tonow"/>
					</div>
					<dl>
							<dt>
								<b>瑾晨</b>
								<strong>13035059860</strong>
							</dt>
							<dd>安徽省合肥市XXXXXXXX</dd>
					</dl>
					<h3><a href="go-address.html"><img src="/taobao/images/write.png"/></a></h3>
				</div>-->
			</header>
			<div class="buy-list" th:each="goods:${cartList}">
				<ul>
					<a th:href="@{'/taobao/goodsDetail/'+${goods.goodsid}}">
						<figure>
							<img th:src="@{${goods.img}}"/>
						</figure>
						<li>
							<h3 th:text="${goods.goodsname}">超级大品牌服装，现在够买只要998</h3>
							<span>
								
							</span>
							<b th:text="'￥'+${goods.price}">￥32.00</b>
							<small th:text="'x'+${goods.count}">×3</small>
						</li>
					</a>
				</ul>
				<dl>
					<dd>
						<span>运费</span>
						<small>包邮</small>
					</dd>
					<dd>
						<span>商品总额</span>
						<small id="totalBlance" th:text="'￥'+${totalprice}">￥98.00</small>
					</dd>
					<dt>
						<textarea rows="4" placeholder="给卖家留言（50字以内）"></textarea>
					</dt>
				</dl>
			</div>
			
		</section>
		<!--底部不够-->
		<div style="margin-bottom: 9%;"></div>
	</div>
	
	<footer class="buy-footer fixed-footer">
			<p> 
				<small>总金额</small>
				<b th:text="'￥'+${totalprice}">￥98.00</b>
			</p>
				
				<input type="button" onclick="submitOrder()" value="去付款"/>
	</footer>
	
	<script type="text/javascript">
		$(".to-now .tonow label").on('touchstart',function(){
			if($(this).hasClass('ton')){
				$(".to-now .tonow label").removeClass("ton")
			}else{
				$(".to-now .tonow label").addClass("ton")
			}
		})

        var addressid = 1;
        $(function() {
            $(".user-addresslist").click(function () {
                $(this).addClass("check").siblings().removeClass("check");
                addressid =jQuery(this).attr("label");
            });
        });

        function submitOrder(){
            var data = {};
            data.totalBlance=$("#totalBlance").html();
            data.addressid=addressid;


            $.ajax({
                type: "post",
                url: '/person/taobao/submitOrder',
                data: data,
                dataType: "json",
                success:function(res) {
                    console.log(res);
                    if(res.code==0){
                        var id = res.data.id;
                        window.location.href = "/person/taobao/pay/"+id;
                    }else {
                        layer.msg("订单已提交!",2, 8);
                        window.location.href = "/taobao/index"
                    }
                }
            });
        }
	</script>

</body>
</html>